<!--#INCLUDE FILE="conn.asp"-->
<!-- #include file="aFunction_charCode.asp" -->
<!-- #include file="ad_comSub.asp" -->

<%
Call tslt_useridentity12_error_end()
%>

<html>
<head>
<TITLE></TITLE>
<link href=../style/<%=session("tslt_stylefolder")%>/admin.css rel="stylesheet" type="text/css">
<SCRIPT language="JavaScript">
<!--
             function showsubmenu(sid)
             {
                   whichEl = eval("submenu" + sid);
                   if (whichEl.style.display == "none")
                  {
                  eval("submenu" + sid + ".style.display=\"\";");
                  }
                  else
                  {
                      eval("submenu" + sid + ".style.display=\"none\";");
                  }
             }

             var direction = "MyRight"; 
             function PulseLR(num,left)
             {
                  PT = eval("PulseText" + num);
	PT.style.left = left; 
	if(left>document.body.offsetWidth-810) direction = "MyLeft"; 
	if(left<20) direction = "MyRight";
	if(direction =="MyRight") 
                         step = 20;
	else
	        step = -20;
	setTimeout('PulseLR('+num+','+(left+step)+')', 500);
             }
//-->
</SCRIPT>
</head>

<body bgcolor=#aaaac4>
<div id="submenu1" align="center" valign="bottom" style="display:none;position: absolute; top:220; width:330; height:70; left:240;background-color:#000070" width="200" height="100">    
<table id="PulseText1" border="0" style="position: absolute; top:15; width:270; height:40; left:30;" bgcolor="#000070">
      <tr>
             <td align="center">
                       <SCRIPT language=Javascript>passwords(promptInfo_DoClea(0))</SCRIPT>
             </td>
      </tr>
</table>
</div>
<div id="submenu2" align="center" valign="bottom" style="display:none;position: absolute; top:220; width:330; height:70; left:240;background-color:#000070" width="200" height="100">    
<table id="PulseText2" border="0" style="position: absolute; top:15; width:270; height:40; left:30;" bgcolor="#000070">
      <tr>
             <td align="center">
                       <SCRIPT language=Javascript>passwords(promptInfo_DoClea(1))</SCRIPT>
             </td>
      </tr>
</table>
</div>

<CENTER>
<br>
<table><tr><td class="font2">ϴļݿϴļ</td></tr></table>
</CENTER>
<br>
<table bgcolor=#ffffff align="center" width="85%" border="0" cellpadding="0" cellspacing="0" style="BORDER-LEFT:#0098c8 1PX SOLID;BORDER-RIGHT:#0098c8 1PX SOLID;BORDER-TOP:#0098c8 1PX SOLID;BORDER-BOTTOM:#0098c8 1PX SOLID">
         <form method="post" action="doclear.asp" name=form1>
                     <input type="hidden" name="Mydoclear" value="ok">
                     <tr height="22" bgcolor=#FCFDC6> 
                             <td align="center" valign="middle">
                                      <b>ϴļ</b>
                             </td>
                     </tr>
                     <tr align="center"> 
                             <td align="center">
                                         <input type="hidden" name="bfolder" value="UploadFile"> 
                                         <table align="center" width="80%">
                                                  <tr align="center">
                                                           <td>  
                                                                   <br>ûϴļûύļҪʱ<br>ȹر̳(̳ҳ)Ȼ
                                                                   <br>ļܷʱĵȴ
                                                           </td>
                                                  </tr>
                                        </table>
                              </td>
                       <tr align="center"> 
                                <!--   <td height="40"><input name="ButtonD" type="submit" value=" ʼ " onmouseover="showsubmenu(0);showsubmenu(1);PulseLR(1,30);" onclick="PulseLR(1,30);showsubmenu(1);"></td>   -->
                                <td height="40"><input name="ButtonD" type="Button" value=" ʼ " onmouseover="showsubmenu(0);" onclick="PulseLR(1,30);showsubmenu(1);submit();"></td>
                       </tr>
                       <tr height="22" align="center" bgcolor=#FCFDC6>
                               <td><br>
                       </tr>
         </table>
</form>
<center>
<SCRIPT language=Javascript>passwords(promptInfo_DoClea(2))</SCRIPT>
</center>
<br>
<br>
  
<%
dim sure
sure = Request("Mydoclear") 
if sure = "ok" then
       call Mydoclear()
end if

dim sure2
sure2 = Request("MyCopyDUF")
if sure2 = "ok" then
       call MyCopyDUF()
end if
%>

<table bgcolor=#ffffff align="center" width="85%" border="0" cellpadding="0" cellspacing="0" style="BORDER-LEFT:#0098c8 1PX SOLID;BORDER-RIGHT:#0098c8 1PX SOLID;BORDER-TOP:#0098c8 1PX SOLID;BORDER-BOTTOM:#0098c8 1PX SOLID">
         <form method="post" action="doclear.asp" name=form1>
                 <input type="hidden" name="MyCopyDUF" value="ok">
                 <tr height="22" align="center" bgcolor=#FCFDC6>
                          <td><b>ݿϴļ</b>
                 </tr>
                 <tr align="center">
                          <td><br>
                 </tr>
                 <tr align="center">
                          <td height="40">
                                   <table align="center" width="80%">
                                              <tr>
                                                      <td>
                                                             <font color=red><b></b></font>˳ִꡰ ʼ  
ִС <font color=red>ݿϴļ</font> ֹԺܵĲ¼ķעݿ
ļ lyDB ڱϵͳĿ¼£ϴļ UploadFile  eWebEditor ļ£ƵĿ¼ MyCopyFolder ļڡ
ļ󱸷ݺܷʱĵȴݾڷ˽С
                                                      </td>
                                              </tr>
                                   </table>
                          </td>
                 <tr align="center">
                          <td height="40">
                                  <!--  <input name="ButtonC" type="submit" class="input4" value=" ݿϴļ " onmouseover="showsubmenu(2);PulseLR(2,30);" onclick="PulseLR(2,30);showsubmenu(2);"></td>   -->
                                  <input name="ButtonC" type="Button" class="input4" value=" ݿϴļ " onclick="PulseLR(2,30);showsubmenu(2);submit();"></td>
                          </td>
                 </tr>
                 <tr height="22" bgcolor=#FCFDC6>
                          <td>
                                  <br>
                          </td>
                 </tr>
         </form>
</table>
<br>
</BODY>
</HTML>

<%
Call conn_Nothing()

sub Mydoclear()
            Dim rs,spl
            set rs=server.createobject("adodb.recordset")
            sql = "select * FROM article Order By id DESc"
            rs.Open sql,conn,1,2
                        Call cccreateFolder()  
                  do while not rs.eof
                         Dim rs1,Sql1
                         set rs1=server.createobject("adodb.recordset")
                         Sql1 = "SELECT d_SavePathFileName FROM article WHERE id = " & rs("id") 
                         Rs1.Open Sql1, Conn, 0, 1
                                Dim d_SavePathFileName2
                                If Not Rs1.Eof Then
                                       d_SavePathFileName2 = Rs1("d_SavePathFileName")
                                End If
                                Dim aSavePathFileName
                                 aSavePathFileName = Split(d_SavePathFileName2, "|")
                                Dim i
                                For i = 0 To UBound(aSavePathFileName)
                                       l = len(aSavePathFilename(i))
                                       ll = instr(aSavePathFilename(i),"ewebeditor")
                                       aSavePathFilename(i) = right(aSavePathFilename(i),l-ll+1)
                                       Call mmmoveFile(aSavePathFilename(i))
                                Next
                        set Rs1=nothing
                        rs.movenext
                  loop 
            set rs=nothing
            set rs=server.createobject("adodb.recordset")
            sql = "select * FROM article Order By id DESc"
            rs.Open sql,conn,1,2
                               Call cccreateFolder()  
                         do while not rs.eof
                                Dim rs2,Sql2
                                set rs2=server.createobject("adodb.recordset")
                                Sql2 = "SELECT r_SavePathFileName FROM reply WHERE cstr(reply_id)= " & rs("id")
                                Rs2.Open Sql2, Conn, 0, 1
                                        do while not rs2.eof
                                               Dim r_SavePathFileName2
                                               If Not Rs2.Eof Then
                                                       r_SavePathFileName2 = Rs2("r_SavePathFileName")
                                               End If
                                               Dim bSavePathFileName
                                               bSavePathFileName = Split(r_SavePathFileName2, "|")
                                               Dim j
                                               For j = 0 To UBound(bSavePathFileName)
                                                      l = len(bSavePathFilename(j))
                                                      ll = instr(bSavePathFilename(j),"ewebeditor")
                                                      bSavePathFilename(j) = right(bSavePathFilename(j),(l-ll+1))
                                                      Call mmmoveFile(bSavePathFilename(j))
                                                Next
                                                rs2.movenext
                                        loop
                                set Rs2=nothing
                                rs.movenext
                         loop
           rs.close             
           set rs=nothing
           call bulletinImgCopy()
            eupath=server.mappath("../ewebeditor/UploadFile") 
            dim fso
            set fso=server.createobject("scripting.filesystemobject")
            If fso.FolderExists(eupath)=false Then
                  fso.CreateFolder(eupath)
            end if
            Call MyAttributesIsArchive(eupath)     
            fso.deletefolder eupath
            dim ewebpath
            ewebpath=server.mappath("../ewebeditor") 
            dim drvpath
            drvpath=server.mappath("../UploadFile")
            fso.movefolder drvpath, ewebpath & "/"
             Response.write"<SCRIPT language=Javascript>passwords(promptInfo_DoClea(3))</SCRIPT>"
             set fso=nothing
end sub

sub mmmoveFile(cPathFile)
        dim bfolder,backupfolder
        bfolder=trim(request("bfolder"))
        backupfolder=server.MapPath("../" & bfolder)
        filep=server.mappath("../" & cPathFile)
        dim fso
        set fso=server.createobject("scripting.filesystemobject")
              if fso.FileExists(filep) then
                   if fso.FolderExists(backupfolder)=false Then
	        fso.CreateFolder(backupfolder)
                   end if
                   fso.movefile filep,backupfolder & "\"
              end if 
         set fso=nothing
end sub

sub cccreateFolder()
        dim backupfolder
        backupfolder=server.MapPath("..\UploadFile")
        dim fso
        set fso=server.createobject("scripting.filesystemobject")
              if fso.FolderExists(backupfolder)=false Then
                     fso.CreateFolder(backupfolder)
              end if
         set fso=nothing
end sub

function DBName()
        dim fso
        set fso=server.createobject("scripting.filesystemobject")
        dim lyDBPath
        lyDBPath=server.mappath("..\lyDB")
        dim lyDBFolder
        set lyDBFolder = fso.getfolder(lyDBPath)
        dim lyDBFileName
        dim lyDBFileName2
        for each lyDBFileName in lyDBFolder.files
                 lyDBFileName2 = lyDBFileName.Name
                 dim ext
                 ext=fso.GetExtensionName(lyDBFileName2 ) 
                 if ext="mdb" then
                         DBName = lyDBFileName2 
                         Exit for                        
                 end if
        next
end function

sub MyCopyDUF()
        dim Conn
        Set Conn = Server.CreateObject("ADODB.Connection")
        Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
        "Data Source=" & Server.MapPath("../lydb/" &DBName())
        Conn.Open
                conn.execute("update option1 set CopyTime=now()")
        Conn.Close
        set Conn=nothing
        dim fso
        set fso=server.createobject("scripting.filesystemobject")
        dim lyDBpath
        lyDBpath=server.mappath("..\lyDB")
        dim MyCopyFolderPath
        MyCopyFolderPath=server.mappath("..\")
        MyCopyFolderPath=MyCopyFolderPath& "\MyCopyFolder"
        If fso.FolderExists(MyCopyFolderPath & "\lyDB")=false Then
               fso.CreateFolder(MyCopyFolderPath & "\lyDB")
        end if
        fso.deletefolder MyCopyFolderPath & "\lyDB",true
        fso.Copyfolder lyDBpath, MyCopyFolderPath & "\",true
        dim eUpath
        eUpath=server.mappath("..\eWebEditor\UploadFile")
        MyCopyFolderPath=server.mappath("..\")
        MyCopyFolderPath=MyCopyFolderPath& "\MyCopyFolder"
        If fso.FolderExists(MyCopyFolderPath & "\UploadFile")=false Then
               fso.CreateFolder(MyCopyFolderPath & "\UploadFile")
        end if
        fso.deletefolder MyCopyFolderPath & "\UploadFile",true
        fso.Copyfolder eUpath, MyCopyFolderPath & "\"
        Response.write"<SCRIPT language=Javascript>passwords(promptInfo_DoClea(4))</SCRIPT>"
        set fso=nothing
end sub

sub bulletinImgCopy()
                  dim rs,sql
                  dim bulletinsql,bulletin_SavePathFileName,bulletin_SavePathFileName_count
                  dim k,l,ll
                  set rs=server.createobject("adodb.recordset")
                  sql = "select * FROM option1 Order By id DESc"
                  rs.Open sql,conn,1,2
                               Call cccreateFolder()  
                        do while not rs.eof
                               if rs("bulletin_SavePathFileName")<>"" then
                                      bulletin_SavePathFileName=rs("bulletin_SavePathFileName")
                               end if
                               bulletin_SavePathFileName_count = Split(bulletin_SavePathFileName, "|")
                               For k = 0 To UBound(bulletin_SavePathFileName_count)
                                       l = len(bulletin_SavePathFileName_count(k))
                                       ll = instr(bulletin_SavePathFileName_count(k),"ewebeditor")
                                       bulletin_SavePathFileName_count(k) = right(bulletin_SavePathFileName_count(k),l-ll+1)
                                       Call mmmoveFile(bulletin_SavePathFileName_count(k))
                                Next
                               rs.movenext
                       loop 
                  rs.close
                  set rs=nothing
end sub

Sub MyAttributesIsArchive(path)
	On Error Resume Next
	Dim fso 
	Dim objFolder
	Dim objSubFolder 
	Dim objFile 
	Dim nowpath
	Set fso=Server.CreateObject("Scripting.FileSystemObject")    
	If Not fso.FolderExists(path) Then          
		Set fso=Nothing
		Exit Sub
	End If
	Set objFolder=fso.GetFolder(path)   
	Response.Write "<ul>"
	For Each objSubFolder In objFolder.Subfolders
                                   Response.write "<li>ļ:" &  objSubFolder.name &"</li>"
                                   objSubFolder.attributes=Archive
		nowpath=path + "\" + objSubFolder.name  
		Call MyAttributesIsArchive(nowpath)                   
	Next
	For Each objFile In objFolder.Files
                                   Response.write "<SCRIPT language=Javascript>passwords(promptInfo_DoClea(5))</SCRIPT>" & objFile.name &"<SCRIPT language=Javascript>passwords(promptInfo_DoClea(6))</SCRIPT>"
                                   objFile.attributes=Archive
	Next
                 Response.Write "</ul>"
	Set objFolder=Nothing
	Set fso=Nothing
End Sub
%>